<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\models\project\Project;

/* @var $this yii\web\View */
/* @var $model common\models\projectrepo\ProjectRepo */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', '项目申报书'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="project-repo-view">

    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a(Yii::t('app', '查看项目'), ['project/view', 'id' => $model->pr_id], ['class' => 'btn btn-primary']) ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'number',
            
            [
                'attribute' => 'category',
                'value' => Project::getArrayCategory()[$model->category],
            ],
            
            'name',
            'firstname',
            'secondname',
            'repo_unit',
            'contacts',
            'telephone',
            'mobile_phone',
            'email:email',
            
            [
                'attribute' => 'application_date',
                'format' => ['date', 'Y-M-d H:i'],
            ],
            
            'fill_instructions',
            'leader_name',
            'leader_mobile',
            'leader_email:email',
            'leader_profession',
            'contact_name',
            'contact_mobile',
            'contact_email:email',
            'contact_address',
            'contact_fax',
            'contact_telephone',
            'coop_name',
            'coop_leader',
            'coop_telephone',
            'repo_unitname',
            'repo_supervisor',
            'repo_leadername',
            'repo_property',
            'repo_profile',
            [
                'attribute' => 'background',
                'format' => 'raw',
            ],
            
            [
            'attribute' => 'main_contents',
            'format' => 'raw',
            ],
            
            [
            'attribute' => 'existing_basis',
            'format' => 'raw',
            ],
            
            [
            'attribute' => 'expected_results',
            'format' => 'raw',
            ],

        ],
    ]) ?>
    
    <table class="table table-striped table-bordered detail-view">
        <thead>
            <th>实施阶段</th>
            <th>目标内容</th>
            <th>开始时间</th>
            <th>结束时间</th>
        </thead>
        <tbody>
            <?php if(!empty($model->schedule_target)) { ?>
            <?php foreach ($model->schedule_target as $k=>$vo) { ?>
            <tr>
                <td>第 <?= $k+1 ?> 阶段</td>
                <td><?= $vo ?></td>
                <td><?= $model->schedule_starttime[$k] ?></td>
                <td><?= $model->schedule_endtime[$k] ?></td>
            </tr>
            <?php } ?>
            <?php } ?>
        </tbody>
    </table>

    <table class="table table-striped table-bordered detail-view">
        <thead>
            <th>序号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>职务职称</th>
            <th>工作单位</th>
            <th>在本项目中承担的主要工作</th>
            <th>备注</th>
        </thead>
        <tbody>
            <?php if(!empty($model->mainpart_name)) { ?>
            <?php foreach ($model->mainpart_name as $k=>$vo) { ?>
            <tr>
                <td><?= $k+1 ?></td>
                <td><?= $vo ?></td>
                <td><?= $model->mainpart_age[$k] ?></td>
                <td><?= $model->mainpart_profession[$k] ?></td>
                <td><?= $model->mainpart_unit[$k] ?></td>
                <td><?= $model->mainpart_mainwork[$k] ?></td>
                <td><?= $model->mainpart_note[$k] ?></td>
            </tr>
            <?php } ?>
            <?php } ?>
        </tbody>
    </table>

    
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'total_budget',
            'apply_budget',
            'own_budget',
            'nation_budget',
            'unit_budget',
            'other_budget',
        ],
     ]) ?>

    <table class="table table-striped table-bordered detail-view">
        <thead>
            <th>序号</th>
            <th>内容</th>
            <th>金额</th>
            <th>备注</th>
        </thead>
        <tbody>
            <?php if(!empty($model->paid_content)) { ?>
            <?php foreach ($model->paid_content as $k=>$vo) { ?>
            <tr>
                <td><?= $k+1 ?></td>
                <td><?= $vo ?></td>
                <td><?= $model->paid_money[$k] ?></td>
                <td><?= $model->paid_note[$k] ?></td>
            </tr>
            <?php } ?>
            <?php } ?>
        </tbody>
    </table>           
            
            
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            
            
            [
            'attribute' => 'calculation_basis',
            'format' => 'raw',
            ],
            
            [
                'attribute' => 'repo_option',
                'format' => 'raw',
            ],
        ],
    ]) ?>

</div>
